﻿<cfscript>    
    view = createObject("component", "views.layout");   
    view.init("#APPLICATION.Name#", "/" & Session.RootDir & "/static/js/viewData.js","",index);
    view.html();    
</cfscript>

<cffunction name="index" access="public" output="true" returntype="any">
    <cfscript>
        kq = createObject("component", "DatabaseQueries.Kronos");
        nq = createObject("component", "DatabaseQueries.Navigator");
        Employee = kq.getCurrentEmployees(SESSION.myUserInfo.HR_PersonIDNo);
        EmployeeAddress = kq.getEmployeeAddress(SESSION.myUserInfo.HR_PersonIDNo);
        EmployeePhones = kq.getEmployeePhones(SESSION.myUserInfo.HR_PersonIDNo);
        EmployeeEmail = kq.getEmployeeEmail(SESSION.myUserInfo.HR_PersonIDNo);
        EmployeeContacts = kq.getEmployeeContacts(SESSION.myUserInfo.HR_PersonIDNo);
        EmployeeEducation = kq.getEmployeeEducation(SESSION.myUserInfo.HR_PersonIDNo);
        EmployeePayStatus = kq.getEmployeePayStatus(SESSION.myUserInfo.HR_PersonIDNo);
        EmployeeNav = nq.getNavEmployees(SESSION.myUserInfo.Finance_IDNO);
        EmployeeNav401K125 = nq.getNavEmployees401K125(SESSION.myUserInfo.Finance_IDNO);
    </cfscript>

    <table class="dataTable" width="100%">
        <thead>
            <tr>
                <th width="25%">Data - Kronos</th>
                <th>Current Value - Kronos</th>       
            </tr>
        </thead>
        <tbody>
            <tr>
                <td valign="top"><strong>Name</strong></td>
                <td valign="top">
                    <strong>First:</strong> #Employee.FirstName# <br />
                    <strong> Middle:</strong> #Employee.MiddleName# <br />
                    <strong>Last:</strong> #Employee.LastName# <br />
                    <strong>Suffix:</strong> #Employee.NameSuffix#
                </td>
            </tr>
            <tr>
                <td valign="top"><strong>Home Address</strong></td>
                <td valign="top">
                    <cfloop query="EmployeeAddress" >
                        <cfif trim(EmployeeAddress.PersonAddressTypeIdNo) EQ "13">
                            #EmployeeAddress.PersonAddress1# #( EmployeeAddress.PersonAddress2 eq "" ? "" : EmployeeAddress.PersonAddress2 )# <br />
                            #EmployeeAddress.PersonAddressCity#, #EmployeeAddress.State# #EmployeeAddress.PersonAddressPostalCode#
                        </cfif>
                    </cfloop>
                </td>
            </tr>
            <tr>
                <td valign="top"><strong>Mailing Address</strong></td>
                <td valign="top">
                    <cfloop query="EmployeeAddress" >
                        <cfif trim(EmployeeAddress.PersonAddressTypeIdNo) EQ "17">
                            #EmployeeAddress.PersonAddress1# #( EmployeeAddress.PersonAddress2 eq "" ? "" : EmployeeAddress.PersonAddress2 )# <br />
                            #EmployeeAddress.PersonAddressCity#, #EmployeeAddress.State# #EmployeeAddress.PersonAddressPostalCode#
                        </cfif>
                    </cfloop>
                </td>
            </tr>
            <tr>
                <td valign="top"><strong>Home Phone Number</strong></td>
                <td valign="top">
                    <cfloop query="EmployeePhones" >
                        <cfif trim(EmployeePhones.TypeCode) EQ "Home">
                            #EmployeePhones.PersonPhoneNo#
                        </cfif>
                    </cfloop>
                </td>
            </tr>
            <tr>
                <td valign="top"><strong>Mobile Phone Number</strong></td>
                <td valign="top">
                    <cfloop query="EmployeePhones" >
                        <cfif trim(EmployeePhones.TypeCode) EQ "Mobile">
                            #EmployeePhones.PersonPhoneNo#
                        </cfif>
                    </cfloop>
                </td>
            </tr>
            <tr>
                <td valign="top"><strong>Personal Email</strong></td>
                <td valign="top">
                    <cfloop query="EmployeeEmail" >
                        <cfif EmployeeEmail.EMailPrimaryInd EQ 1>
                            <strong>Personal:</strong> #EmployeeEmail.EmailAddress# <br />
                        <cfelse>
                            <strong>Other:</strong> #EmployeeEmail.EmailAddress# <br />
                        </cfif>
                    </cfloop>                    
                </td>
            </tr>
            <tr>
                <td valign="top"><strong>Emergency Contact 1</strong></td>
                <td valign="top">
                    <cfloop query="EmployeeContacts" >
                        <cfif EmployeeContacts.EmergencyContactCallOrder EQ 1>
                            <strong>#EmployeeContacts.FirstName# #EmployeeContacts.LastName#</strong><br />
                            <strong>Phone:</strong> #EmployeeContacts.PersonPhoneNo# <br />
                            <strong>Address:</strong>
                            #EmployeeContacts.PersonAddress1# #( EmployeeContacts.PersonAddress2 eq "" ? "" : EmployeeContacts.PersonAddress2 )# <br />
                            #EmployeeContacts.PersonAddressCity#, #EmployeeContacts.State# #EmployeeContacts.PersonAddressPostalCode#
                        </cfif>
                    </cfloop>
                </td>
            </tr>
            <tr>
                <td valign="top"><strong>Emergency Contact 2</strong></td>
                <td valign="top">
                    <cfloop query="EmployeeContacts" >
                        <cfif EmployeeContacts.EmergencyContactCallOrder EQ 2>
                            <strong>#EmployeeContacts.FirstName# #EmployeeContacts.LastName#</strong><br />
                            <strong>Phone:</strong> #EmployeeContacts.PersonPhoneNo# <br />
                            <strong>Address:</strong>
                            #EmployeeContacts.PersonAddress1# #( EmployeeContacts.PersonAddress2 eq "" ? "" : EmployeeContacts.PersonAddress2 )# <br />
                            #EmployeeContacts.PersonAddressCity#, #EmployeeContacts.State# #EmployeeContacts.PersonAddressPostalCode#
                        </cfif>
                    </cfloop>
                </td>
            </tr>
            <tr>
                <td valign="top"><strong>Education 1</strong></td>
                <td valign="top">
                    <cfloop query="EmployeeEducation" >
                        <cfif EmployeeEducation.CurrentRow EQ 1>
                            <strong>School:</strong> #EmployeeEducation.College# <br />
                            <strong>Degree:</strong> #EmployeeEducation.Degree# <br />
                            <strong>Major:</strong> #EmployeeEducation.Major# <br />
                            <strong>Year Graduated:</strong> #EmployeeEducation.GraduationYear#
                        </cfif>
                    </cfloop>                    
                </td>
            </tr>
            <tr>
                <td valign="top"><strong>Education 2</strong></td>
                <td valign="top">
                    <cfloop query="EmployeeEducation" >
                        <cfif EmployeeEducation.CurrentRow EQ 2>
                            <strong>School:</strong> #EmployeeEducation.College# <br />
                            <strong>Degree:</strong> #EmployeeEducation.Degree# <br />
                            <strong>Major:</strong> #EmployeeEducation.Major# <br />
                            <strong>Year Graduated:</strong> #EmployeeEducation.GraduationYear#
                        </cfif>
                    </cfloop>
                </td>
            </tr>
            <tr>
                <td valign="top"><strong>Education 3</strong></td>
                <td valign="top">
                    <cfloop query="EmployeeEducation" >
                        <cfif EmployeeEducation.CurrentRow EQ 3>
                            <strong>School:</strong> #EmployeeEducation.College# <br />
                            <strong>Degree:</strong> #EmployeeEducation.Degree# <br />
                            <strong>Major:</strong> #EmployeeEducation.Major# <br />
                            <strong>Year Graduated:</strong> #EmployeeEducation.GraduationYear#
                        </cfif>
                    </cfloop>
                </td>
            </tr>
            <tr>
                <td valign="top"><strong>Position</strong></td>
                <td valign="top">
                    <strong>Title:</strong> #Employee.Title# <br />
                    <strong>Department:</strong> #Employee.Department# <br />
                    <strong>Division:</strong> #Employee.Division# 
                </td>
            </tr>
            <tr>
                <td valign="top"><strong>Current Rate of Pay</strong> <!---<img src="images/dialog-warning.png" />---></td>
                <td valign="top">
                    <a href="##" id="payrate" class="important" onclick="return false;">Click here to Show Payrate</a>
                    <span class="hideme" id="payrate">#NumberFormat(EmployeePayStatus.PayRate, '$__.__')# x #EmployeePayStatus.AnnualizingFactor# = #NumberFormat(EmployeePayStatus.PayRate * EmployeePayStatus.AnnualizingFactor, '$__.__')#</span>
                </td>
            </tr>
            <tr>
                <td valign="top"><strong>Scheduled Hours Per Week (FTE)</strong></td>
                <td valign="top">#NumberFormat(EmployeePayStatus.StandardUnitsPerWeek, '_')#</td>
            </tr>
        </tbody>
    </table>
    
    
    <br />
    <br />
    
    
    <table class="dataTable" width="100%">
        <thead>
            <tr>
                <th width="25%">Data - Navigator</th>
                <th>Current Value - Navigator</th>                
            </tr>
        </thead>
        <tbody>
            <tr>
                <td valign="top"><strong>Name</strong></td>
                <td valign="top">
                    <strong>First:</strong> #EmployeeNav.FirstName# <br /> 
                    <strong> Middle:</strong> #EmployeeNav.MiddleName# <br />
                    <strong>Last:</strong> #EmployeeNav.LastName#
                </td>                
            </tr>
            <tr>
                <td valign="top"><strong>Date of Birth</strong></td>
                <td valign="top">#DateFormat(EmployeeNav.DOB, "mm/dd/yyyy")#</td>
            </tr>
            <tr>
                <td valign="top"><strong>Mailing Address</strong></td>
                <td valign="top">
                     #EmployeeNav.Address# #( EmployeeNav.Address2 eq "" ? "" : EmployeeNav.Address2 )# <br />
                     #EmployeeNav.City#, #EmployeeNav.State# #EmployeeNav.PostCode#
                </td>
            </tr>
            <tr>
                <td valign="top"><strong>Primary Phone Number</strong></td>
                <td valign="top">#EmployeeNav.HomePhoneNumber#</td>
            </tr>
            <tr>
                <td valign="top"><strong>Section 125 Cafeteria Plan</strong></td>
                <td valign="top">
                    <cfloop query="EmployeeNav401K125" >
                        <cfif EmployeeNav401K125.PayrollRateCode EQ "125REIMBAM">
                            <strong>Unreimbursed Healthcare:</strong> #NumberFormat(EmployeeNav401K125.Amount)#
                        </cfif>
                    </cfloop>
                    <br />
                    <cfloop query="EmployeeNav401K125" >
                        <cfif EmployeeNav401K125.PayrollRateCode EQ "125 DC AMT">
                            <strong>Dependent Daycare:</strong> #NumberFormat(EmployeeNav401K125.Amount)#
                        </cfif>
                    </cfloop>
                </td>
            </tr>
            <tr>
                <td valign="top"><strong>Medical Coverage</strong></td>
                <td valign="top"></td>
            </tr>
            <tr>
                <td><strong>401(K) Withholding</strong></td>
                <td>
                    <cfloop query="EmployeeNav401K125" >
                        <cfif EmployeeNav401K125.PayrollRateCode EQ "401k PERC">
                            #(EmployeeNav401K125.Amount * 100)#%
                        </cfif>
                    </cfloop>
                </td>
            </tr>
            <tr>
                <td valign="top"><strong>Work Schedule</strong></td>
                <td valign="top">
                    <cfloop query="EmployeeNav401K125" >
                        <cfif EmployeeNav401K125.PayrollRateCode EQ "WORK WEEK">
                            #NumberFormat(EmployeeNav401K125.Amount)#
                        </cfif>
                    </cfloop>
                </td>
            </tr>
            <tr>
                <td valign="top"><strong>Banking Information</strong></td>
                <td valign="top"></td>
            </tr>
            <tr>
                <td valign="top"><strong>W-4 Election</strong></td>
                <td valign="top">
                    <strong>Marital Status:</strong> #EmployeeNav.FilingStatusCode# <br />
                    <strong>Allowances:</strong> #EmployeeNav.ExtraWithholding# <br />
                    <strong>Additional Withholding:</strong> #EmployeeNav.Allowances#
                </td>
            </tr>
        </tbody>
    </table>
</cffunction>